package com.approval.approvalapp.center.centerfragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.alibaba.fastjson.JSON;
import com.approval.approvalapp.R;
import com.approval.approvalapp.bean.BjtjQsList;
import com.approval.approvalapp.center.adapter.BjtjQsAdapter;
import com.approval.approvalapp.util.base.BaseFragment;
import com.approval.approvalapp.util.net.NetRequsetUtil;
import com.approval.approvalapp.util.net.interfacepac.NetDownResponse;

import java.util.List;

import butterknife.Bind;

/**
 * A simple {@link Fragment} subclass.
 */
public class BjtjQsFragment extends BaseFragment {



    @Bind(R.id.rv)
    RecyclerView rv;

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_bjtj_qs;
    }

    @Override
    public void initView(View view) {
        NetRequsetUtil.getInstance().netRequestGet("v1/user/queryRegionBJInfo", new NetDownResponse() {
            @Override
            public void success(String str) {
                List<BjtjQsList> bjtjQsLists = JSON.parseArray(str, BjtjQsList.class);
                rv.setLayoutManager(new LinearLayoutManager(BjtjQsFragment.this.getActivity()));
                BjtjQsAdapter bjtjQsAdapter = new BjtjQsAdapter();
                rv.setAdapter(bjtjQsAdapter);
                bjtjQsAdapter.setBjtjQsLists(bjtjQsLists);
            }

            @Override
            public void errowithresponse(String str) {

            }

            @Override
            public void erro() {

            }

            @Override
            public void finish() {

            }
        });
    }

    @Override
    public void initData() {

    }

}
